package com.steven.design.JieGou_Pattern.zuhe;

import java.util.ArrayList;
import java.util.List;

public class Manager extends Component{

    private List<Component> componentList = new ArrayList<>();

    Manager(String zhiWei, String job) {
        super(zhiWei, job);
    }
    //添加雇员
    public void addComponent(Component component){
        componentList.add(component);
    }
    //删除雇员
    public void removeComponent(Component component){
        componentList.remove(component);
    }

    //检查工作
    @Override
    void check() {
        work();
        for (Component component: componentList) {
            component.work();
        }
    }
}
